package com.zb.sannuo.account.controller;

import com.zb.sannuo.account.service.AccountPasswordService;
import com.zb.sannuo.common.domain.vo.UserLogin;
import com.zb.sannuo.common.result.Result;
import com.zb.sannuo.common.result.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/pp")
@Api(tags = "系统账号管理模块",description = "对系统账号管理进行CRUD操作" )
@CrossOrigin
public class AccountPasswordController {

    @Resource
    private AccountPasswordService accountPasswordServiceImpl;


    //重置密码
    @RequestMapping(value = "password",method = RequestMethod.POST)
    @ApiOperation(value = "重置密码",notes = "重置密码",httpMethod = "POST")
    public Result trueStatus(UserLogin userLogin) throws Exception{
        System.out.println(userLogin);
        int i = accountPasswordServiceImpl.updatePassword(userLogin);
        if (i>0){
            return Result.ok(ResultCode.SUCCESS,i);
        }else{
            return Result.fail(ResultCode.FAIL,null);
        }
    }
}
